//
//  UIView+OMAnimation.m
//  OMENGO
//
//  Created by 梁尚嘉 on 2017/3/6.
//  Copyright © 2017年 Kamfat. All rights reserved.
//

#import "UIView+OMAnimation.h"

@implementation UIView (OMAnimation)
- (void)addInstanceScaleAnimationWithTargetScale:(CGFloat)scale
                                         reverse:(BOOL)reverse
                                        duration:(NSTimeInterval)duration
{
    CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
    scaleAnimation.fromValue         = @(1);
    scaleAnimation.toValue           = @(scale);
    scaleAnimation.autoreverses      = reverse;
    scaleAnimation.duration          = duration;
    scaleAnimation.timingFunction    = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
    [self.layer addAnimation:scaleAnimation forKey:nil];
}
@end
